<%@ page contentType="text/html; charset=UTF-8" buffer="16kb"%>
<%@ include file="../include/taglib.jsp"%>
<%
    response.setHeader("Cache-Control", "no-store");
    response.setHeader("Pragrma", "no-cache");
    response.setDateHeader("Expires", 0);
    Long resid = Long.parseLong(request.getParameter("id"));
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>linux综合性能页面</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta name="Keywords" content=" " />
<meta name="Description" content=" " />
<%@ include file="../include/common.jsp"%>
<%@ include file="../include/table.jsp"%>

<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/style/default/bsm/sub_menu.css" />
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/style/default/bsm/perf/listPage.css" />
<script type="text/javascript"
	src="${pageContext.request.contextPath}/resources/charts/FusionCharts.js"></script>
	
<script type="text/javascript"
	src="${pageContext.request.contextPath}/resources/charts/FusionCharts.jqueryplugin.js"></script>
	
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/common/Xslider.js"></script>

<script type="text/javascript">

	var tcpChart;
	function initIO(){
		if(typeof tcpChart == undefined || tcpChart == null){
			tcpChart =  new FusionCharts( "${pageContext.request.contextPath}/resources/charts/MSSpline.swf?ChartNoDataText=没有数据","tcpChart1", "100%", "100%", "0", "1" );
		}
		
		//连接数曲线
		$.ajax({
			url : 'real-time!get2LineChart.action', // 
			type : 'POST',
			dataType : "json",
			data : {
				resId :<%=resid %>,
				propIds:'110307000000006,110307000000007'
			},
			success : function(data) {
				tcpChart.setJSONData(data);
				tcpChart.render("ioLineChart");
			}
		});
		
	}
	
	var fsColChartc;
	var heapChart;
	var timeChart;
	var connChart;
	function initBaseInfo(){
			//内存使用
			$.ajax({
				url : 'real-time!getHLineGauge.action', // 
				type : 'POST',
				dataType : "json",
				data : {
					resId :<%=resid %>,
					childType:'1203070100000',
					maxPropId:'120307010000006',
					usePropId:'120307010000005',
					unit:'KB'
				},
				success : function(data) {
					if(typeof heapChart == undefined || heapChart == null){
						heapChart =  new FusionCharts( "${pageContext.request.contextPath}/resources/charts/HLinearGauge.swf?ChartNoDataText=没有数据","heapChart1", "100%", "130", "0", "1" );
					}
					heapChart.setJSONData(data);
					heapChart.render("uptimeDiv");
				}
			});
			
			//CPU
			$.ajax({
				url : 'real-time!getHLineGauge.action', // 
				type : 'POST',
				dataType : "json",
				data : {
					resId :<%=resid %>,
					childType:'1203070100000',
					maxPropId:'120307010000004',
					usePropId:'120307010000003',
					unit:''
				},
				success : function(data) {
					if(typeof timeChart == undefined || timeChart == null){
						timeChart =  new FusionCharts( "${pageContext.request.contextPath}/resources/charts/HLinearGauge.swf?ChartNoDataText=没有数据","timeChart11", "100%", "130", "0", "1" );
					}
					timeChart.setJSONData(data);
					timeChart.render("timeDiv");
				}
			});
	      
			//基本信息
			$.ajax({
				url : 'real-time!getBaseInfo.action', // 
				type : 'POST',
				dataType : "json",
				data : {
					resId :<%=resid %>,
					propIds:'prop_110307000000005'
				},
				success : function(data) {
					$('#prop_110307000000005').text(data.prop_110307000000005); //OS版本
					$('#resIp').text(data.ip);
				}
			});
			
			
			//站点用户数
			if(typeof fsColChartc == undefined || fsColChartc == null){
				fsColChartc =  new FusionCharts( "${pageContext.request.contextPath}/resources/charts/Column2D.swf","fsColChart11", "100%", "130", "0", "1" );
			}
			$.ajax({
				url : 'real-time!get2ColumnChart.action', // 
				type : 'POST',
				dataType : "json",
				data : {
					resId :<%=resid %>,
					detail:1,
					childType:'1203070200000',
					propIds:'120307020000001',
					top:'5'
				},
				success : function(data) {
					fsColChartc.setJSONData(data);
					fsColChartc.render("userCol");
				}
			});
			
			//站点连接数
			if(typeof connChart == undefined || connChart == null){
				connChart =  new FusionCharts( "${pageContext.request.contextPath}/resources/charts/Column2D.swf","connChart11", "100%", "130", "0", "1" );
			}
			$.ajax({
				url : 'real-time!get2ColumnChart.action', // 
				type : 'POST',
				dataType : "json",
				data : {
					resId :<%=resid %>,
					detail:1,
					childType:'1203070200000',
					propIds:'120307020000001',
					top:'5'
				},
				success : function(data) {
					connChart.setJSONData(data);
					connChart.render("connCol");
				}
			});
	}
	
	
	$(document).ready(function() {
			initBaseInfo();
			initIO(); 
		//CPU 内存 每10S刷新一次
		setInterval('initBaseInfo()',60000);
		
	});
</script>

</head>
<body>
	
	<div class="column">
		<div class="col-main">
			<!--基本信息-->
			<div class="col-l-extra h-400">
			<h2 class="title-h2 m-0">基本信息</h2>
			<ul class="col-l-ul">
					<li><span class="col-l-ul-l" >中间件类别:</span><span 
								class="col-l-ul-r"><img src="${pageContext.request.contextPath}/style/default/bsm/perf/images/iis.gif">&nbsp;IIS</span>
					</li>
					<li><span class="col-l-ul-l" class="baseinfo">IP:</span><span id="resIp"
						class="col-l-ul-r"></span>
					</li>
					<li><span class="col-l-ul-l" class="baseinfo">线程数:</span><span id="prop_110307000000005"
						class="col-l-ul-r"></span>
					</li>
			</ul>
			</div>
			<!--@end基本信息-->
			<div class="col-r-main">
				<div class="col-v-rate-extra" >
				   <h2 class="title-h2 m-0">内存使用</h2>
					<div id="uptimeDiv"></div>
				</div>
				<!--@end基本信息-->
				<div class="col-v-rate-extra f-r">
				   <h2 class="title-h2 m-0">CPU时间</h2>
				   <div id="timeDiv"></div>
			    </div>
			    <div class="col-v-rate-extra">
		            <h2 class="title-h2 m-0">站点用户数 TOP5</h2>
			        <div id="userCol"></div>
			    </div>
			    
				<div class="col-v-rate-extra f-r">
				   <h2 class="title-h2 m-0">站点连接数 TOP5</h2>
				   <div id="connCol"></div>
			    </div>
		 </div>   
	  </div>
	</div>
	
	
	  <div class="column b-1">
		  <h2 class="title-h2 m-0">IO [当天趋势图]-[IO读,IO写]</h2>
	           <div id="ioLineChart" class=" h-150 w-100"></div>
		</div>
	
	   <div class="column" style="width:100%;height:5px;"></div>
</body>